{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 两数相加"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "1+2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 0到4的循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(i)\n",
    "  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x10f11f7f0>]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAD8CAYAAACLrvgBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAH89JREFUeJzt3X2UXHWd5/H3tx/z1HnuNHmChKR5\nSEAwRIg6owIKCTgEHdkJxyNZ5Ux2XNjVceco6s7A6jgruqsje5BZRrKCRwUUkazmgQzgw6pgOgih\nQ4CuEEia7nR1nrvSSXe667t/1K9D0VR3VzrddW91f17n1Klbv/u79fvmpjuf3Ht/VdfcHRERkXyU\nRF2AiIgUD4WGiIjkTaEhIiJ5U2iIiEjeFBoiIpI3hYaIiORNoSEiInlTaIiISN4UGiIikreyqAsY\natOnT/d58+ZFXYa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BGRvP1/Xx2EEhbY6EcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10f02b6d8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "    import matplotlib.pyplot as plt\n",
    "\n",
    "    import numpy as np\n",
    "\n",
    "    x = np.arange(20)\n",
    "\n",
    "    y = 2**x\n",
    "\n",
    "    plt.plot(x, y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### numpy简单数组的使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3 5 4]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "mm = np.array((1,2,3))\n",
    "pp = np.array((2,3,1))\n",
    "print(mm+pp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2 3]]\n",
      "[[2 3 1]]\n",
      "3\n",
      "[[1 2 3 1]]\n",
      "[[11]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "#使用mat的矩阵\n",
    "ss = np.mat([1,2,3])\n",
    "print(ss)\n",
    "\n",
    "#使用matrix的矩阵\n",
    "mm = np.matrix([2,3,1])\n",
    "print(mm)\n",
    "\n",
    "#矩阵的访问\n",
    "print(mm[0,1])\n",
    "\n",
    "#将普通列表转换为矩阵\n",
    "ary = [1,2,3,1]\n",
    "m_ary = np.matrix(ary)\n",
    "print(m_ary)\n",
    "\n",
    "#矩阵相乘\n",
    "print(mm*ss.T)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04',\n",
      "               '2017-01-05', '2017-01-06', '2017-01-07'],\n",
      "              dtype='datetime64[ns]', freq='D')\n",
      "--------------------------------\n",
      "                   A         B         C         D\n",
      "2017-01-01  0.473782  0.879762  0.167746 -0.849500\n",
      "2017-01-02  0.281344  0.944247 -0.317598 -1.047510\n",
      "2017-01-03  0.884837  1.245753 -1.549847 -1.681908\n",
      "2017-01-04 -0.026120  0.820528  0.883335 -0.067273\n",
      "2017-01-05 -0.479834  0.467381 -1.582196 -0.073477\n",
      "2017-01-06  0.813675 -0.039144 -0.776877 -1.784282\n",
      "2017-01-07  1.148112 -1.899543 -1.012354  0.235687\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "dates = pd.date_range('20170101', periods=7)\n",
    "print(dates)\n",
    "\n",
    "print(\"--\"*16)\n",
    "df = pd.DataFrame(np.random.randn(7,4), index=dates, columns=list('ABCD'))\n",
    "print(df)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
